package ;
import easelhx.utils.Ticker;
import js.Lib;

/**
 * ...
 * @author 
 */

class TextLinksExample extends Example
{

	public function new() 
	{
		super();
	}
	
	override public function run():Void 
	{
		super.run();
		
		stage.enableMouseOver(20);

		// Create some TextLinks:
		var links = ["yellow", "blue", "green", "red", "purple", "orange"];
		for (i in 0...links.length) {
			var link:TextLink = new TextLink(links[i]+" link!", "36px Arial", links[i], "#FF0000");
			link.x = 100;
			link.y = 50+i*50;
			link.onClick = handleClick;
			stage.addChild(link);
		}

		// we want to do some work before we update the canvas,
		// otherwise we could use Ticker.addListener(stage);
		Ticker.addListener(stage);
	}
	
	private function handleClick(evt) : Void
	{
		Lib.alert("You clicked on: "+evt.target.text);
	}
	
}